home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: What is &Variable (declared as: char Variable[10])?
- Date: 02 Mar 1996 19:15:57 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Mar2121557@qcd.lanl.gov>
- References: <4gqpa1$3h9@alcor.usc.edu> <4gsdno$1bg@umbc9.umbc.edu>
- <4gvlnlINNppj@anvil.ugrad.cs.ubc.ca> <DnLx2r.323@eskimo.com>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: scs@eskimo.com's message of Fri, 1 Mar 1996 21:01:38 GMT
-
- In article <DnLx2r.323@eskimo.com>
- scs@eskimo.com (Steve Summit) writes:
-
- <snip>
- SS: A client programmer might reasonably assume that the sequence
- SS:
- SS: abstract_t x;
- SS: f(x);
- SS:
- SS: could not modify x. In C, this assumption is of course not valid
- SS: if abstract_t happens to have array type.
-
- Sometime back in comp.std.c there was a post which demonstrated a
- slightly different problem with abstract_t being an array type: the
- following does not compile:
-
- void g(abstract_t *z){}
- void f(abstract_t x){g(&x);}
- int main {abstract_t y={0}; f(y);}
-
- (In that post the question was about va_list being such an abstract
- type, but the problem is a general one.)
-
-
- SS:
- SS: As it happens, standard C does contain one abstract type which
- SS: is, underneath, an array: jmp_buf, from <setjmp.h>. Because
- SS: setjmp() is traditionally called as
- SS:
- SS: jmp_buf env;
- SS: setjmp(env);
- SS:
- SS: and because setjmp() is in fact specified as accepting a
- SS: parameter of type jmp_buf, but since setjmp must modify its
- SS: argument, we are left with the peculiar requirement that jmp_buf,
- SS: though seemingly abstract, must be an array type.
- SS:
-
- No. The standard specifies that setjmp may be a macro. (setjmp)(env)
- is not legal, neither is #undef setjmp followed by setjmp(env). As a
- macro can modify its argument, no requirement on jmp_buf actually
- exists.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-